﻿<%@ Page Language="C#" MasterPageFile="~/Management.master" AutoEventWireup="true" CodeFile="WorkOrderView.aspx.cs" Inherits="workOrderView" Title="Untitled Page" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc2" %>

<%@ Register Assembly="EclipseWebSolutions.DatePicker" Namespace="EclipseWebSolutions.DatePicker"
    TagPrefix="ews" %>
<%@ Register assembly="StrengthControls.Scrolling" namespace="StrengthControls.Scrolling" tagprefix="cc1" %>


<asp:Content ID="Content1" ContentPlaceHolderID="m_contentBody" Runat="Server">
   
    <body>
     
         <asp:TextBox ID="txtHiddenworkOrderId" runat="server" Width="77px" 
            Visible="False"></asp:TextBox>                          
    <div id="containerright" class="containerright">
          <div id="TabbedPanels1" class="TabbedPanels">
                <ul class="TabbedPanelsTabGroup">
                  <li class="TabbedPanelsTab" tabindex="0">List work orders</li>
                  <li class="TabbedPanelsTab" tabindex="1">Work order detail</li>
                  <li class="TabbedPanelsTab" tabindex="2">Add new work Order </li>
                </ul>
              <div class="TabbedPanelsContentGroup">

                  <div class="TabbedPanelsContent">
                  
                  
<table  class="GridItem" cellspacing="2"  cellpadding="2" style="width:auto; height:350">
<tr><td align="center" class="BigLabel" >
       
         <asp:Label ID="lblTotalEquipment" runat="server" Text="Label"></asp:Label><br /><asp:Label ID="lblMessageValidate" runat="server" CssClass="permissionstyle"></asp:Label>
  </td></tr>
  
   <tr >
             <td  align="center" class="GridItem"  style="text-align:center">
             <asp:GridView ID="grdTemporary" runat="server" AllowPaging="True" Width="750px" 
                     AutoGenerateColumns="False"  Visible ="False" DataSourceID="dsMessage" 
                     
                     CellPadding="4" ForeColor="#333333" GridLines="None" PageSize="2">
                 <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                 <RowStyle BackColor="#EFF3FB" />
                 <Columns>
                     <asp:BoundField DataField="Label" />
                 </Columns>
             
                <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                   <RowStyle BackColor="#EFF3FB" />
                   <SelectedRowStyle BackColor="#FF5050" />
                   <HeaderStyle BorderStyle="None" CssClass="GridViewHeader" Height="20px" 
                        Width="30px" />
                        
                    <PagerStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                    <EditRowStyle BackColor="LightGray" />
                    <RowStyle CssClass="AlternativeRowStyle" />
                    <AlternatingRowStyle BackColor="White" CssClass="AlternativeRowStyle" />
                    
                 
             </asp:GridView >
             
                 <asp:ObjectDataSource ID="dsMessage" runat="server" SelectMethod="GetMessage" 
                     TypeName="DirectService"></asp:ObjectDataSource>
             <br />
             </td>    
         </tr>
        
<tr><td align="center" class="GridItem" >
    
<asp:UpdatePanel ID="updatePanelEquipment" runat="server">
            <ContentTemplate>
         
                <asp:ObjectDataSource ID="odsSparepart" runat="server" 
                    SelectMethod="GetWorkOrders" TypeName="WODirectService" 
                    onselected="odsSparepart_Selected">
                    <SelectParameters>
                        <asp:ControlParameter ControlID="txtHiddenWhereClause" Name="whereClause" 
                            PropertyName="Text" Type="String" />
                        
                    </SelectParameters>
                </asp:ObjectDataSource>
                       
                
    <tr><td>
    <div style=" height:350px; width:auto; overflow:auto">
    <asp:TextBox ID="txtHiddenPageIndex" runat="server" Visible="False"></asp:TextBox>
    <a id="detailPosition"></a>
       <asp:TextBox ID="txtHiddenWhereClause" runat="server" Height="17px" Width="205px" Visible="False"></asp:TextBox>
       <asp:TextBox ID="txthiddenOrderbyClause" runat="server"  Width="77px" 
            Visible="False"></asp:TextBox>
              <Triggers>
                <asp:AsyncPostBackTrigger ControlID="txtHiddenWhereClause" EventName="TextChanged" />
                
            </Triggers>
            <Triggers>
            <asp:AsyncPostBackTrigger ControlID="txthiddenOrderbyClause" EventName="TextChanged" />
            </Triggers>
        	    <asp:GridView ID="grdEquipment" runat="server" AllowPaging="True" 
            AllowSorting="True" AutoGenerateColumns="False" BorderStyle="None" 
            CssClass="GridItem" DataKeyNames="WORKORDERID" DataSourceID="odsSparepart" 
            OnPageIndexChanging="grdEquipment_PageIndexChanging" 
            onrowcancelingedit="grdEquipment_RowCancelingEdit" 
            onrowdatabound="grdEquipment_RowDataBound1" 
            onselectedindexchanged="grdEquipment_SelectedIndexChanged" 
            RowHeaderColumn="EquipmentId" width="720px" PageSize="12" onrowcommand="grdEquipment_RowCommand" 
            >
                    <HeaderStyle BorderStyle="None" CssClass="GridViewHeader" Height="20px" />
                    <Columns>
                        <asp:CommandField ShowSelectButton="True" >
                            <ItemStyle Width="50px" />
                        </asp:CommandField>
                         <asp:TemplateField>
                            <ItemTemplate>
                               <a title="Add new work Order" href="workOrderView.aspx?tabIndex=2">
                                <img border="0" height="20" src="images/add.png" width="20"> </img></a>
                            </ItemTemplate>
                            <ItemStyle Width="15px" />
                        </asp:TemplateField>
                        <%--<asp:TemplateField>
                            <ItemTemplate>
                               <a title="Detail" href="workOrderView.aspx?detail=false&tabIndex=1&workOrderId=<%# DataBinder.Eval(Container.DataItem, "WorkOrderId") %>">
                                <img border="0" height="20" src="images/b_view.png" width="20"> </img></a>
                            </ItemTemplate>
                            <ItemStyle Width="15px" />
                        </asp:TemplateField>--%>
                        
                         <asp:TemplateField>
                            <ItemTemplate>
                               <a title="Delete" href="javascript:confirmDelete('workOrderView.aspx?delete=true&userId=<%# DataBinder.Eval(Container.DataItem, "EmployeeId") %>&tabIndex=0&workOrderId=<%# DataBinder.Eval(Container.DataItem, "workOrderId")%>&pageIndex=<%=GetPageIndex()%>')">
                                <img border="0" height="15" src="images/del.png" width="15"> </img></a>
                            </ItemTemplate>
                           <ItemStyle Width="15px" />
                        </asp:TemplateField>
                         <asp:TemplateField>
                            <ItemTemplate>
                                
                                <a title="view planning" href="planningView.aspx?workOrderId=<%# DataBinder.Eval(Container.DataItem, "WorkOrderId") %>""> 
                                    <img border=0  src="images/addPlanning.png" width="20" height="20">
                                </a> 
                            </ItemTemplate>
                            <ItemStyle Width="15px" />
                        </asp:TemplateField>
                        <asp:BoundField DataField="WORKORDERID" HeaderText="ID Nº" 
                            SortExpression="WORKORDERID">
                            <ItemStyle HorizontalAlign="Left" Width="50px" />
                        </asp:BoundField>
                        
                        <asp:BoundField DataField="EMPLOYEENAME" HeaderText="Request Staff" 
                            SortExpression="EMPLOYEENAME">
                            <ItemStyle HorizontalAlign="Left" Width="190px" />
                        </asp:BoundField>
                        
                        
                        <asp:BoundField DataField="DATEREQUEST" DataFormatString="{0:MM/dd/yyyy}" 
                            HeaderText="Request date" HtmlEncode="False" SortExpression="DATEREQUEST">
                            <ItemStyle HorizontalAlign="Left" Width="90px" />
                        </asp:BoundField>
                        
                        
                        <asp:BoundField DataField="Criteria" HeaderText="Criteria" 
                            SortExpression="Criteria">
                            <ItemStyle HorizontalAlign="Left" Width="120px" />
                        </asp:BoundField>
                        <asp:BoundField DataField="DATEREQUIRED" HeaderText="Date required" 
                            SortExpression="DATEREQUIRED">
                            <ItemStyle HorizontalAlign="Right" Width="90px" />
                        </asp:BoundField>
                      
                        <asp:BoundField DataField="EmployeeId" HeaderText="EmployeeId" 
                            Visible="False" />
                    </Columns>
                    <PagerStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                    <EditRowStyle BackColor="LightGray" />
                    <RowStyle CssClass="RowStyle" />
                    <AlternatingRowStyle CssClass="AlternativeRowStyle" />
        </asp:GridView>
        	    </ContentTemplate>
        	    </asp:UpdatePanel>
        </td></tr>

          </div>         
        
         
    </table>
        </div>
        <div class="TabbedPanelsContent" >
             <iframe  class="FrameDimension" src="workOrderDetail.aspx?displayMode=<%=GetDisplayMode()%>&workOrderId=<%=txtHiddenworkOrderId.Text%>&authorize=<%=GetAuthorize()%>"  frameborder="0" ></iframe></div><!--This content will be included not use Iframe when using dynamique programing-->
        <div class="TabbedPanelsContent" >
             <iframe  class="FrameDimension" src="workOrderAddAdmin.aspx"  frameborder="0" ></iframe></div><!--This content will be included not use Iframe when using dynamique programing-->     
             
        
    </div>
    </div>


 </body>
</asp:Content>

<asp:Content ID="Content2" runat="server" contentplaceholderid="conSearch">
   
    &nbsp;
            <div class="AccordionPanel">
        	    <div class="AccordionPanelTab"><b class="contentcolor"><asp:ImageButton ID="ImageButton1" runat="server" ImageUrl="~/images/indicator.png" />&nbsp;WORK ORDER</b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </div>
        	    <div class="AccordionPanelContent">
        	    <div style="height:30px"> 
        	   
                    <asp:CheckBox ID="chkAuthorized" runat="server" 
                        Text="Authorized Work order"/>
                                   
                                   </div>
                                <div style="height:30px"> 
                                 <asp:CheckBox ID="chkNewWO" runat="server" Text="New work Order" />
                                 </div>
                               
                                
        	     <div style="height:30px"> Request date: &nbsp;
                                <asp:TextBox ID="txtRequestDate" runat="server" Width="76px"></asp:TextBox>
            <asp:Image ID="imgCalendar" runat="server" ImageUrl="~/images/calendar.png" />
            <cc2:CalendarExtender ID="CalendarExtender3" runat="server" TargetControlID="txtRequestDate" PopupButtonID="imgCalendar">
            </cc2:CalendarExtender> 
                                </div>
                <div style="height:30px"> Required date :
                                <asp:TextBox ID="txtRequiredDate" runat="server" Width="75px"></asp:TextBox>
            <asp:Image ID="imgRequiredDate" runat="server" ImageUrl="~/images/calendar1.png" />
            <cc2:CalendarExtender ID="CalendarExtender1" runat="server" TargetControlID="txtRequiredDate" PopupButtonID="imgRequiredDate">
            </cc2:CalendarExtender> 
                                </div>
                 <div style="height:50px">
                        Request staff : 
                        <asp:DropDownList ID="drlEmployee" runat="server" Height="20px" 
                          Width="195px" AppendDataBoundItems="True" 
                          DataTextField="EmployeeName" DataValueField="EmployeeId" 
                            DataSourceID="odsEmployee">
                                    <asp:ListItem Value="-1">--- Choose Employee---</asp:ListItem>
                        </asp:DropDownList>
                                <asp:ObjectDataSource ID="odsEmployee" runat="server" 
                            SelectMethod="GetRequestEmployees" TypeName="Service.ReferenceDataService">
                        </asp:ObjectDataSource>
                                </div>
                                <div style="height:50px">
                        Criteria: &nbsp;<asp:DropDownList ID="drlCriteria" runat="server" Height="20px" 
                          Width="195px" AppendDataBoundItems="True" DataSourceID="odsCriteria" 
                          DataTextField="CriteriaLabel" DataValueField="CriteriaId" 
                          >
                                        <asp:ListItem Value="-1">--- Choose a criteria ---</asp:ListItem>
                                    </asp:DropDownList>
                                    <asp:ObjectDataSource ID="odsCriteria" runat="server" 
                                        SelectMethod="GetCriterias" TypeName="Service.WorkOrderService">
                                    </asp:ObjectDataSource>
                                </div>
                                <div style="height: 50px">
                                    W.O&nbsp;Request type : &nbsp;<asp:DropDownList ID="drlRequestType" runat="server" Height="20px" 
                          Width="195px" AppendDataBoundItems="True" DataSourceID="odsRequestType" 
                          DataTextField="RequestTypeLabel" DataValueField="RequestTypeId">
                                    <asp:ListItem Value="-1">--- Choose WO request type---</asp:ListItem>
                        </asp:DropDownList>
                                    <asp:ObjectDataSource ID="odsRequestType" runat="server" 
                                        SelectMethod="GetRequestTypes" TypeName="Service.WorkOrderService">
                                    </asp:ObjectDataSource>
                                &nbsp; 
                    </div>
                     <div style="height: 50px">
                                    Work order status : 
                                     <asp:DropDownList ID="drlStatus" runat="server" Height="20px" Width="195px" 
                                    AppendDataBoundItems="True" DataSourceID="odsStatus" DataTextField="TaskStatusLabel" 
                                    DataValueField="TaskStatusId">
                                    <asp:ListItem Value="-1">--- Work Order Status ---</asp:ListItem>
                                </asp:DropDownList>
                                <asp:ObjectDataSource ID="odsStatus" runat="server" SelectMethod="GetTaskStaus" 
                                    TypeName="Service.WorkOrderService"></asp:ObjectDataSource>

                                &nbsp; 
                    </div>
                  
                 <br />
                  
                                   
               &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    <asp:Button  ID="btnSearch" 
                        runat="server" Height="25px" Text="Search" 
        Width="71px" BorderStyle="Dotted" onclick="btnValidate_Click" CssClass="btnexpress" 
                        EnableViewState="False" />
            
        </div></div>
 
  
</asp:Content>
